import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/diy-bouquet',
    name: 'diyBouquet',
    component: () => import('@/views/user/DIYBouquetCreator.vue'),
  },
  //重写diy页面
  {
    path: '/diy',
    name:'DiyView',
    component: () => import('@/views/DIY/DiyView.vue'),
    children:[
      {
        path: '',
        redirect: '/diy/ai'
      },
      {
        path: 'ai',
        name: 'DiyAI',
        component: () => import('@/views/DIY/DiyAI.vue')
      },
      {
        path:'diy-create',
        name: 'DiyCreate',
        component: () => import('@/views/DIY/DiyCreate.vue')
      },
      {
        path:'diy-popular',
        name: 'DiyPopular',
        component: () => import('@/views/DIY/DiyPopular.vue')
      },
      {
        path:'diy-ai-speak',
        name: 'DiyAISpeak',
        component: () => import('@/views/DIY/DiyAISpeak.vue')
      },
    ]
  },
  {
    path: '/auth',
    name: 'auth',
    component: () => import('@/views/UserAuth.vue')
  },
  {
    // 用户中心及其子路由
    path: '/user',
    component: () => import('@/views/user/UserCenterLayout.vue'),
    children: [
      {
        path: '',
        redirect: '/user/orders'
      },
      {
        path: 'orders',
        name: 'userOrders',
        component: () => import('@/views/user/UserOrders.vue')
      },
      {
        path: 'shoucang',
        name: 'userShoucang',
        component: () => import('@/views/user/ShouCang.vue')
      },
      {
        path: 'dianzan',
        name: 'userDianzan',
        component: () => import('@/views/user/DianZan.vue')
      },
      {
        path: 'settings',
        name: 'userSettings',
        component: () => import('@/views/user/UserSettings.vue')
      }
    ]
  },
  {
    path: '/more',
    component: () => import('@/views/more/MoreServiceLayout.vue'),
    children: [
      {
        path: '',
        redirect: '/more/community'
      },
      {
        path: 'community',
        name: 'community',
        component: () => import('@/views/more/FlowerCommunity.vue')
      },
      {
        path: 'flower-care',
        name: 'flowerCare',
        component: () => import('@/views/more/FlowerCareGuide.vue')
      },
      {
        path: 'special-service',
        name: 'specialService',
        component: () => import('@/views/more/FlowerDeliveryService.vue')
      },
      {
        path: 'monthly-flower',
        name: 'monthlyFlower',
        component: () => import('@/views/more/MonthlyFlowerCalendar.vue')
      },
      {
        path: 'feedback',
        name: 'feedback',
        component: () => import('@/views/more/UserFeedback.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL || ''),
  routes
})

export default router